﻿using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Unicode;
using System.Threading.Tasks;

namespace JiaNetFrame.Core.utils
{
    public static class JsonHelper
    {  
        /// <summary>
       /// 对象序列化成JSON字符串。
       /// </summary>
       /// <param name="obj">序列化对象</param>
       /// <returns></returns>
        public static string ToJson(this object obj)
        {
            var result = JsonConvert.SerializeObject(obj, new DataTableConverter());
 
            return result;
        }
        public static JArray ToJson(string obj)
        {
            var result = new JArray(ToJson(obj));

            return result;
        }
    }
}
